const users = require('../database/usersModel')

//注册
const register = (req, res) => {
    users.register(req, res).then(() => {
        res.json({
            code: 200,
            mas: '注册成功'
        })
    })
}

//登录
const login = (req, res) => {
    users.login(req, res).then((result) => {
        let x = result.length
        if (x > 0) {
            res.json({
                code: 200,
                mas: '登录成功'
            })
        } else {
            res.json({
                code: -1,
                mas: '登录失败'
            })
        }
    })
}


module.exports = {
    register,
    login
}